<?php echo $header; ?><?php echo $column_left; ?>
<style type="text/css">
#categories {
    border-top: medium none;
    padding-top: 0;
}
#categories {
    border-bottom: 1px solid #C8C8C8;
    clear: both;
    margin-bottom: 15px;
    padding-top: 15px;
}
#categories-title {
    background: url("/site/sc/images/bg_categories_title.gif") no-repeat scroll right top #1D76AF;
    padding-right: 5px;
}

#categories-title-wrapper {
    background: url("/site/sc/images/bg_categories_title.gif") no-repeat scroll left top #1D76AF;
    padding-left: 5px;
}

#categories-title h5 {
    background: url("/site/sc/images/bg_categories_title.gif") repeat-x scroll 0 -33px #1D76AF ;
    color: #FFFFFF;
    font-size: 16px;
    height: 33px;
    line-height: 33px;
    text-indent: 6px;
}


#categories table {
    margin-top: 5px;
    width: 100%;
}
#categories td {
    padding-bottom: 2px;
}
#home-list h5 {
    color: #207FBB;
    font-size: 20px;
}
#categories a {
    background: url("/site/sc/images/green_bullet.gif") no-repeat scroll 0 5px transparent;
    color: #116EA9;
    font-size: 12px;
    padding-left: 10px;
}
#categories a:hover {
    color: #54A20D;
}
</style>
<script type="text/javascript">
	$(function(){
		$("#products>div").hover(
			function(){
				$(this).css({background:"url(catalog/view/theme/default/images/products_hover.png) repeat-x",border:"1px solid #83b3ca"});
			},
			function(){
				$(this).css({background:"none",border:"1px solid #ffffff"});
			}
		);
	})
</script>
<div class="page">
	<div class="inner">
   		<div class="navigation">
		    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
		    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
		    <?php } ?>
        </div>
        <?php if (isset($hot_products)) {?>
        	<div class="panel">
                <h3>Hot sales</h3>
                <div id="hotSales">
                	<?php foreach($hot_products as $product){ ?>
                	<div style="float:left;width:335px">
				 		<a  href="<?php echo $this->url->link ( 'product/product', 'product_id=' . $product ['product_id'] );?>" target="_blank"> 
	                    	<img src=<?php echo $product['image']; ?> style="float:left;margin-right:5px" ></a><a  href="<?php echo $this->url->link ( 'product/product', 'product_id=' . $product ['product_id'] );?>" target="_blank">
	                        <span><?php echo $product['name'];?></span><br />
	                        <?php if (!$product['special']) { ?>
							<font class="price-font"><?php echo $product['price']; ?></font>
							<?php } else { ?>
							<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo round($product['special'],2); ?></span>
							<?php } ?>
		                        <?php if($product['discount']!=0){ ?>
							<span>(<?php echo $product['discount'];?>%off)</span>
							<div><?php echo $product['discount'];?>%<br />off</div>
							<?php }?>
	                    </a>
	                </div>
                    <?php } ?>
                </div>
            </div>
        <?php }?>
    	
        
    	<?php if(isset($category_screen) && 0!=count($category_screen)){?>
    		<div class="panel" id="product">
				<?php foreach($category_screen as $screens){ ?>
					<h2>
					    <b><?php echo $screens[0]['name'];?>:</b>
					    <?php foreach($screens as $screen){ ?>
						 <a <?php if(isset($cat_condition[$screen['attribute_id']])&&$cat_condition[$screen['attribute_id']]==$screen['text']) {?> class="sel" <?php }?> href="javascript:void(0)" onclick="add_condition(<?php echo $screen['attribute_id'];?>,'<?php echo $screen['text'];?>')">
							<?php echo $screen['text'];?>
						 </a>
					    <?php } ?>
					</h2>
				<?php } ?>
				<?php if($cat_hid) { ?>
					<?php foreach($cat_hid as $cats){ ?>
					<h2 style="display:none" class='hidden'>
					    <b><?php echo $cats[0]['name'];?>:</b>
					    <?php foreach($cats as $screen){ ?>
							<a <?php if(isset($cat_condition[$screen['attribute_id']])&&$cat_condition[$screen['attribute_id']]==$screen['text']) {?> class="sel" <?php } ?> href="javascript:void(0)" onclick="add_condition(<?php echo $screen['attribute_id'];?>,'<?php echo $screen['text'];?>')">
								<?php echo $screen['text'];?>
							</a>
					    <?php } ?>
					</h2>
					<?php } ?>
				<div class="list_show" id="list_show" onclick="cat_hid()">
					<input type="hidden" value="1" id="cat_control">
				</div>
				<?php } ?>
				<?php if ($cat_condition) {?>
					<h2 class="sels">
						<b>Screening Conditions:</b>
							<?php foreach($cat_condition as $k=>$v){ ?>
							<a href="javascript:void(0)" onclick="del_condition(<?php echo $k;?>)" ><span><?php echo $v;?></span></a>
							<?php } ?>
					</h2>
				<?php } ?>
			</div>
		<?php } ?>
		<!--
		<?php if(isset($manufacturer)){ ?>
			<div class="panel" id="manufacturer">
				<h2 style="font-size: 12px;">
					    <b style="color: #960401;">Manufacturer:</b>
					    <?php foreach($manufacturer as $manu){ ?>
							<a  href="index.php?route=product/category&path=111&mid=<?php echo $manu['manufacturer_id']; ?>"><?php echo $manu['name']; ?>
							</a>
					    <?php } ?>
					</h2>
			</div>
		<?php } ?>

		<?php if(isset($ext_parents)){ ?>
			<div class="panel" id="ext_parents">
				<h2 style="font-size: 12px;">
					    <b style="color: #960401;">Models:</b>
					    <?php foreach($ext_parents as $ext_parent){ ?>
							<a href="index.php?route=product/category&path=111&mid=<?php echo $ext_parent['mid'];?>&&pid=<?php echo $ext_parent['parent_id']; ?>" <?php if($ext_parent['parent_id']==$this->request->get['pid']){ ?> class="sel" <?php }?>  ><?php echo $ext_parent['name']; ?>
							</a>
					    <?php } ?>
					</h2>
			</div>
		<?php } ?>
		<div class="panel">
				<h2 style="font-size: 12px;">
					    <b style="color: #960401;"><?php echo $cats['name'];?>:</b>
					    <?php foreach($cats['children'] as $manu){ ?>
							<a  href="index.php?route=product/category&path=<?php echo $manu['pid'].'_'.$manu['id']; ?>"><?php echo $manu['name']; ?>
							</a>
					    <?php } ?>
					</h2>
			</div>
		-->

		<?php if(isset($two_cats)){ 
			if($this->data['last_cat']){?>
		
				<?php foreach($two_cats as $cats){ 
					$i=0;
				?>
				<div id="categories">
					<div id="categories-title-wrapper">
						<div id="categories-title">
							<h5><?php echo $cats['name'];?></h5>
						</div>
					</div>
					<table cellspacing="0" cellpadding="0" class="justToUseFromAJAX">
						<tr><td colspan="2">
							<table width="100%" cellspacing="0" cellpadding="0" border="0">
							<?php foreach ($cats['children'] as $cat) {
								if($i%3==0){?>
									<tr valign="top" height="20">
								<?php }?>
								<td>
									<div class="category-cell">
										<h5><a href="index.php?route=product/category&path=<?php echo $cats['id'];?>_<?php echo $cat['id'];?>"><?php echo $cat['name'];?></a></h5>
									</div>
								<span style="display: none"><printer_name><?php echo $cat['name'];?></printer_name><printer_id>463864</printer_id></span>
								</td>
								<?php if($i%3==2){?>
									</tr>
								<?php }
									$i++;
								?>

							<?php }?>
							</table>
							</td>
						</tr>
					</table>
				</div>
				
				<?php } ?>
			<?php }else{ if($two_cats){ ?>
				<div id="categories">
					<div id="categories-title-wrapper">
						<div id="categories-title">
							<h5><?php echo $breadcrumbs[count($breadcrumbs)-1]['text'];?></h5>
						</div>
					</div>
					<table cellspacing="0" cellpadding="0" class="justToUseFromAJAX">
						<tr><td colspan="2">
							<table width="100%" cellspacing="0" cellpadding="0" border="0">
							<?php foreach ($two_cats as $cat) {
								if($i%3==0){?>
									<tr valign="top" height="20">
								<?php }?>
								<td>
									<div class="category-cell">
										<h5><a href="index.php?route=product/category&path=<?php echo $cats['id'];?>_<?php echo $cat['id'];?>"><?php echo $cat['name'];?></a></h5>
									</div>
								<span style="display: none"><printer_name><?php echo $cat['name'];?></printer_name><printer_id>463864</printer_id></span>
								</td>
								<?php if($i%3==2){?>
									</tr>
								<?php }
									$i++;
								?>

							<?php }?>
							</table>
							</td>
						</tr>
					</table>
				</div>
			<?php }}?>
			<?php }?>
        <div id="products" style="line-height: 30px;">
            <h1>
                <b>showing <?php echo $start." - ".$end." of ".$total;?> Results</b>
                &nbsp;&nbsp;&nbsp;&nbsp;
				<a href="index.php?route=product/category&path=<?php echo $category_id;?>&sort=pd.name&order=<?php echo $name_order;?>&filter_id=<?php echo $filter_id;?>&filter_text=<?php echo $filter_text;?>"><span style="<?php echo $name_css;?>" >name</span></a>
                <a href="index.php?route=product/category&path=<?php echo $category_id;?>&sort=p.price&order=<?php echo $price_order;?>&filter_id=<?php echo $filter_id;?>&filter_text=<?php echo $filter_text;?>"><span style="<?php echo $price_css;?>" >price</span></a>
               <!--  <a href="index.php?route=product/category&path=<?php echo $category_id;?>&sort=total_num&order=<?php echo $sell_order;?>&filter_id=<?php echo $filter_id;?>&filter_text=<?php echo $filter_text;?>"><span>sell</span></a> -->
                <a href="index.php?route=product/category&path=<?php echo $category_id;?>&sort=p.viewed&order=<?php echo $review_order;?>&filter_id=<?php echo $filter_id;?>&filter_text=<?php echo $filter_text;?>"><span style="<?php echo $review_css;?>">review</span></a>
            </h1>
            <?php foreach ($products as $product) { ?>
                <div>
					<a href="<?php echo $product['href'];?>" target="_blank" title="<?php echo $product['old_name']?>">
                    <img src="<?php echo $product['thumb']; ?>" />
                    <h3 style="height:40px;overflow:hidden"><?php echo $product['name']; ?></h3>
                    <?php if (!$product['special']) { ?>
					<font class="price-font"><?php echo $product['price']; ?></font>
					<?php } else { ?>
						<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo round($product['special'],2); ?></span>
					<?php } ?>
					<?php if($product['discount_per']!=0){ ?>
						<span>(<?php echo $product['discount_per'];?>%off)</span>
						<div><?php echo $product['discount_per'];?>%<br />off</div>
					<?php }?>
					</a>
                </div>
            <?php } ?>
        </div>
        <div class="pagination"><?php echo $pagination; ?></div>
    </div>
</div>
<script type="text/javascript">
	function add_condition(aid,text){
		$.ajax({
			url:"index.php?route=product/category/add_condition",
			data:{"aid":aid,"text":text,"cid":<?php echo $category_id;?>},
			type: 'post',
			success: function(data) {
				window.location.reload();
			}
		})
	}

	function del_condition(aid){
		$.ajax({
			url:"index.php?route=product/category/del_condition",
			data:{"aid":aid,"cid":<?php echo $category_id;?>},
			type: 'post',
			success: function(data) {
				window.location.reload();
			}
		})
	}

	function cat_hid(){
		if($('#cat_control').val()==1){
			$(".hidden").each(function(){
				$(this).show();
				//background:url(../images/img_01.png) top center no-repeat;
			})
			$("#list_show").css("background","url(catalog/view/theme/default/images/img_01_2.png) top center no-repeat");
			$('#cat_control').val(2);
		}else{
			$(".hidden").each(function(){
				$(this).hide();
				
				//background:url(../images/img_01.png) top center no-repeat;
			})
			$("#list_show").css("background","url(catalog/view/theme/default/images/img_01.png) top center no-repeat");
			$('#cat_control').val(1);
		}

	}
</script>
<?php echo $footer; ?>